from selenium import webdriver

import time
class web_test:

    url = "https://p-iot.hang-shu.com/#/login"
    def a(self,uname,pwd,chkcode):
        driver = webdriver.Chrome()
        driver.implicitly_wait(3)
        driver.get(self.url)

        driver.maximize_window()
        driver.find_element_by_css_selector('input[placeholder="账号"]').send_keys(uname)
        driver.find_element_by_css_selector('input[placeholder="密码"]').send_keys(pwd)
        driver.find_element_by_css_selector('input[placeholder="验证码"]').send_keys(chkcode)
        driver.find_element_by_css_selector(
            'button[class="el-button btn_login el-button--default el-button--medium"]').click()
        time.sleep(1)
        try:
            alertext = driver.find_element_by_css_selector('p[class="el-message__content"]').text
            # print(alertext)
            driver.quit()
            return alertext
        except  Exception as e:
            print("报错了，内容：", e)
            return e








